package com.dhu.graph.basic.edge;

import java.io.Serializable;

/**
 * @ Author ：snow
 * @ Date   ：Created in 2020-05-13
 * @ Description：
 * @ Modified By：
 * @ Version:
 */
public class DirectedEdge implements Serializable {
    private static final long SERIALIZABLE_UID = 737363627239393L;

    private int from;      // 指出点
    private int to;     // 指向点
    private double weight;  // 边的权重

    public DirectedEdge(int from, int to, double weight){
        this.from = from;
        this.to = to;
        this.weight = weight;
    }

    public int from() {
        return from;
    }

    public void setFrom(int from) {
        this.from = from;
    }

    public int to() {
        return to;
    }

    public void setTo(int to) {
        this.to = to;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    @Override
    public String toString() {
        return String.format("%d -> %d,  %.2f ", from,to,weight);
    }
}
